cCloseButton = {}
cCloseButton.Height = 16
cCloseButton.Width = 16
cCloseButton.X = 0
cCloseButton.Y = 0
cCloseButton.OnClick = nil
cCloseButton.Image = nil
cCloseButton.OnMouseUp = nil
cCloseButton.OnMouseDown = nil
cCloseButton.Visible = false

function cCloseButton:Init()	

end

function cCloseButton:SetVisible(bool)
	if not type(bool) == "boolean" then return end
	cCloseButton.Visible = bool
	gui.EnableScreenClicker( bool )
end

function cCloseButton:Paint()
	if cCloseButton.Visible then		
		surface.SetMaterial(Material(cCloseButton.Image))
		surface.DrawTexturedRect(self.X,self.Y,self.Height,self.Width)	
	end
	return true
end

function cCloseButton:SetImage(image)
	cCloseButton.Image = image
end

function cCloseButton:OnMousePressed( m )
	self:GetParent():Remove()
	if LocalPlayer().BuildMode == true then
		gui.EnableScreenClicker(true)
	else
		gui.EnableScreenClicker(false)
	end
	surface.PlaySound("buttons/button14.wav")
end

vgui.Register("cCloseButton", cCloseButton, "Panel")